package com.weetop.cfw.utils

import android.view.View
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import com.weetop.cfw.R

class GlideUtils {

    companion object{

        fun loadImage(view:View,url:String,imageView:ImageView){
            Glide.with(view).load(url).into(imageView)
        }

        fun loadImage(imageView: ImageView,uri:String,destImageView: ImageView){
            Glide.with(imageView).load(uri).into(destImageView)
        }

        fun loadImage(imageView: ImageView,imageResId:Int,destImageView: ImageView){
            Glide.with(imageView).load(imageResId).into(destImageView)
        }

        fun loadHeadImg(imageView: ImageView,imgUrl:String,destImageView: ImageView){
            Glide.with(imageView).load(imgUrl).apply(RequestOptions().error(R.mipmap.place_image_holder).apply(RequestOptions().transform(CircleCrop())).placeholder(R.mipmap.place_image_holder)).into(destImageView)
        }
    }
}